package com.gec.oasys.service.impl;

import com.gec.oasys.dao.SysRoleMapper;
import com.gec.oasys.pojo.SysRole;
import com.gec.oasys.service.SysRoleService;
import com.gec.oasys.util.SoulPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SysRoleServiceImpl implements SysRoleService {
    @Autowired
    private SysRoleMapper sysRoleMapper;
    @Override
    public SysRole selectByPrimaryKey(Integer id) {
        return sysRoleMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SysRole> querySysRole(SysRole sysRole) {
        return sysRoleMapper.querySysRole(sysRole);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return sysRoleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int deletesByPrimaryKey(String[] strId) {
        for (String strid : strId) {
            sysRoleMapper.deleteByPrimaryKey(Integer.parseInt(strid));
        }
        return strId.length;
    }

    @Override
    public int insert(SysRole record){
        return sysRoleMapper.insert(record);
    }
    @Override
    public int updateByPrimaryKey(SysRole record){
        return sysRoleMapper.updateByPrimaryKey(record);
    }
    @Override
    public Object dataGrid(SoulPage<SysRole> soulPage) {
        return soulPage.setData(sysRoleMapper.dataGrid(soulPage,(SysRole) soulPage.getObj()));
    }
}
